package logger

type LoggerConfig struct {
	IgnoreStdout bool

	TimeFormat             string //使用 github.com/phuslu/fasttime 的格式化字符串
	TimeFormatBufferLength int

	CodeLine           bool
	CodeLineSkipCaller int
	CodeLineLong       bool

	Formatter IFormatter

	ContextPool IContextPool

	SwitchChecker *SwitchChecker
}

func (cfg *LoggerConfig) FixDefault() {
	if cfg.TimeFormat == "" {
		cfg.TimeFormat = "%Y-%m-%d %H:%M:%S.%Q"
	}
	if cfg.TimeFormatBufferLength <= 0 {
		cfg.TimeFormatBufferLength = 24
	}
	if cfg.ContextPool == nil {
		cfg.ContextPool = DefaultContextPool
	}
	if cfg.Formatter == nil {
		cfg.Formatter = DefaultFormatterSeparator
	}
	if cfg.CodeLineSkipCaller < 2 {
		cfg.CodeLineSkipCaller = 2
	}
}
